//
//  ZH_HomeInformationCollectionViewCell.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/18.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_HomeInformationCollectionViewCell.h"
@interface ZH_HomeInformationCollectionViewCell()
@property (nonatomic,weak)UIImageView *pngView;
@end
@implementation ZH_HomeInformationCollectionViewCell
///注册cell
+(void)registerCollectionView:(UICollectionView*)collectionView
{
    [collectionView registerClass:[ZH_HomeInformationCollectionViewCell class] forCellWithReuseIdentifier:@"ZH_HomeInformationCollectionViewCell"];
}

///创建
+(id)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return [collectionView dequeueReusableCellWithReuseIdentifier:@"ZH_HomeInformationCollectionViewCell" forIndexPath:indexPath];
}
//初始化
-(void)initDefault
{
    
}
///加载子视图约束
-(void)loadSubviewConstraints
{
    [self.pngView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.equalTo(self.contentView);
    }];
}
- (void)updateImage:(NSMutableDictionary *)dic{
    if (dic) {
         [self.pngView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",SERVER_TEST,dic[@"ad_url"]]] placeholderImage:nil];
    }
}
#pragma mark - getter,setter
- (UIImageView *)pngView{
    if (!_pngView) {
        UIImageView *image = [UIImageView createImageViewWithName:@""];
        image.backgroundColor = kFontColorRed;
        [self.contentView addSubview:_pngView = image];
    }
    return _pngView;
}
@end
